<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ph="http://java.sun.com/jsf/composite/pharmacy">

    <h:body>

        <ui:composition template="/resources/template/template.xhtml">

            <ui:define name="content">




                <h:form>

                    <p:panel header="All Department Stock Transfer By Adjustment" rendered="#{!pharmacyAdjustmentController.printPreview}">
                        <h:panelGrid columns="2" >
                            <h:panelGrid columns="2">
                                <h:outputLabel value="From Department" ></h:outputLabel>
                                <p:autoComplete  forceSelection="true"  id="acFromDept" 
                                                 value="#{pharmacyAdjustmentController.fromDepartment}" 
                                                 converter="departmentConverter" 
                                                 completeMethod="#{departmentController.completeDept}" 
                                                 var="deptf" itemLabel="#{deptf.name}" 
                                                 itemValue="#{deptf}" >
                                </p:autoComplete>
                                
                                <h:outputLabel value="To Department" ></h:outputLabel>
                                <p:autoComplete  forceSelection="true"  id="acToDept" 
                                                 value="#{pharmacyAdjustmentController.toDepartment}" 
                                                 converter="departmentConverter" 
                                                 completeMethod="#{departmentController.completeDept}" 
                                                 var="deptt" itemLabel="#{deptt.name}" 
                                                 itemValue="#{deptt}" >
                                </p:autoComplete>


                                <p:commandButton id="btnAdjust" value="Transfer All" ajax="false" 
                                                 action="#{pharmacyAdjustmentController.transferAllDepartmentStockAsAdjustment()}" ></p:commandButton>
                                <p:defaultCommand target="btnAdjust"/>
                            </h:panelGrid>

                            
                        </h:panelGrid>
                    </p:panel>

                    <p:panel rendered="#{pharmacyAdjustmentController.printPreview}">
                        <p:commandButton ajax="false" action="#{pharmacyAdjustmentController.makeNull()}" value="New Adjustment"/>
                        <p:commandButton ajax="false" value="Print">
                            <p:printer target="print"/>
                        </p:commandButton>
                        <p:panel id="print">
                            <ph:adjustmentBill  bill="#{pharmacyAdjustmentController.bill}" />
                        </p:panel>
                    </p:panel>

                </h:form>

            </ui:define>


        </ui:composition>

    </h:body>
</html>
